import 'package:flutter/material.dart';

class LocalNav extends StatelessWidget {
  final List localNavList;
  const LocalNav({Key key, @required this.localNavList}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Padding(
        padding: EdgeInsets.all(5),
        child: Container(
          height: 64,
          decoration: BoxDecoration(
              color: Colors.white, borderRadius: BorderRadius.circular(6)),
          child: Padding(
            padding: EdgeInsets.all(7),
            child: _items(context),
          ),
        ));
  }

  _items(BuildContext context) {
    if (localNavList == null) return null;
    List<Widget> items = [];
    localNavList.forEach((model) {
      items.add(_item(context, model));
    });
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: items,
    );
  }

  Widget _item(BuildContext context, model) {
    return GestureDetector(
      onTap: () {},
      child: Column(
        children: [
          Image.network(model['icon'], width: 32, height: 32),
          Text(model['title'], style: TextStyle(fontSize: 12))
        ],
      ),
    );
  }
}
